<template>
  <div class="selfEle">

    <section class="centerSection">
      <a-map popupid="popupid1" @markClick="markClick" ref="a-map"> </a-map>
      <dv-border-box-9 id="popupid1" :color="['#018CF4']" backgroundColor="#00000060"
                       class="cckjfbPopup">
        <i @click="hidePopup" class="iconfont icon-close"></i>
        <div class="cckjfbPopupBody">
          <span style="color: #0092ff" >{{point.name}}</span>
          <dv-decoration-4 :reverse="true" />
          <div class="cckjfbInfo">
          </div>
          <span><span style="color: #3178b2" >地址:</span>{{point.address}}</span><br/>
          <span><span style="color: #3178b2" >类型:</span>{{point.type}}</span><br/>
          <span><span style="color: #3178b2" >邮政编号:</span>{{point.adcode}}</span><br/>
        </div>
      </dv-border-box-9>
    </section>

    <section class="leftSection">
      <charBase @refeshPoint="refeshPoint"  ></charBase>
    </section>


  </div>
</template>

<script>
import aMap from "@/components/map/index";
import charBase from "./charBase";
export default {
  name: "BaseAll",
  components: {
    aMap,
    charBase,
  },
  data() {
    return {
      ifPopup: true,
      zxcwlxInfoArr: ["zxcwlx_pjtcc", "zxcwlx_lstcc", "zxcwlx_ggtcc"],
      markData:[],
      point:{
        name:"天津公安处天津站派出所",
        type:"政府机构及社会团体;公检法机构;公安警察",
        address:"新纬路1号天津站1F层(天津站地铁站9号口步行210米)",
        adcode:"120102",
      }
    };
  },
  computed: {},
  // async created() {
  //   let response = await fetch(`./testData/map-marker-1.json`, {
  //     method: "get",
  //     headers: {
  //       "Content-Type": "application/json",
  //     },
  //   });
  //
  //   console.log("response");
  //   this.markData = await response.json();
  //   console.log(this.markData)
  // },
  mounted() { },
  methods: {
    hidePopup(){
      this.$refs['a-map'].closePopup()
    },
    refeshPoint(pointArr){
      this.$refs['a-map'].renderMarkers(pointArr, {
        rotation: -411,
        zoom: 16.62,
        pitch: 70.3,
        // center: [117.200586, 39.142763]
        center:  pointArr.features[0].geometry.coordinates
      })
    },
    markClick(E){
      this.point.name = E.extData.name;
      this.point.type = E.extData.type;
      this.point.address = E.extData.address;
      this.point.adcode = E.extData.adcode;
    },
    test() {
      console.log("test");
      this.$Toast({
        content: "test",
      });
    },
  },
  beforeDestroy() { },
};
</script>

<style lang="scss" scoped>
.selfEle {
  height: 100%;
  width: calc(100% - 0.3rem);
  display: flex;
  justify-content: space-between;
  align-items: center;
  >section {
    height: 100%;
    //width: 29%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  .centerSection {
    width: 100%;

    .mapImg {
      height: calc(100% - 40px);
      width: calc(100% - 40px);
      margin: 20px;
    }

    .cckjfbPopup {
      //z-index: 8999999;
      //position: absolute;
      height: 33.5%;
      width: 40%;
      top: -40%;
      left: 15%;

      .iconfont {
        margin: 5% 5% 0 0;
        color: #0160c8;
        float: right;
        font-size: xx-large;
        height: 10%;
        width: 10%;
      }

      .cckjfbPopupBody {
        padding: 10%;
        font-size: medium;
        background-color: rgba($color: #000000, $alpha: 0.4);

        >span {
          line-height: 35px;
          color: aliceblue;
        }

        .cckjfbInfo {
          display: flex;
          align-items: center;
          justify-content: center;
          flex-wrap: wrap;
          align-content: center;

          >div {
            width: 45%;
            padding: 6% 0;
            text-align: center;

            >label {
              color: #ffffff;
              font-size: initial;
              font-weight: 600;
              margin-right: 5%;
            }

            >span {
              font-size: x-large;
              font-weight: 800;
            }
          }
        }
      }
    }
  }
  //左侧部分
  .leftSection {
    //background: #0a56e3;
  }
}
</style>
<style>
#popupid1{
  width: 305px;
}
</style>
